UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'NjdsQ1nXw+Sbe2dTT9DfV+xiRBuHkJ9v5OWTUNAmPPg=' 
WHERE 
  key_id = '8eef4a43199ca845c86f90a98eef9299e74cbdacfe0df947c3d84b766b009b9f' 
  AND (
    token = 'NjdsQ1nXw+Sbe2dTT9DfV+xiRBuHkJ9v5OWTUNAmPPg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031