UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'oNSrgxp45WqcLA7Hf7W9IkA2vMzGyz5AmcID0OcAS/4=' 
WHERE 
  key_id = 'd01b3f070507e994360aff024a0713191e6b5f6c4e11b9fed72540ee0d22668f' 
  AND (
    token = 'oNSrgxp45WqcLA7Hf7W9IkA2vMzGyz5AmcID0OcAS/4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031