UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'U4ihYLnxRZ0hQwoKf0XGDFwbI1yhSmB/HSR4RCdyeAY=' 
WHERE 
  key_id = '8a2a30f440989962e960c8df807e92a1a219154c38eaf05fc771bac2b82da91e' 
  AND (
    token = 'U4ihYLnxRZ0hQwoKf0XGDFwbI1yhSmB/HSR4RCdyeAY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028