UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ns8svQbTk97Hk0mMrZuPT6S/8gHzs5CRPgxTGQRWS6g=' 
WHERE 
  key_id = '8b24855ca4a06c32f9742c87effa47b3078d03c7f4d9cace37e277d58a2f8167' 
  AND (
    token = 'ns8svQbTk97Hk0mMrZuPT6S/8gHzs5CRPgxTGQRWS6g=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040