UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'q/loLiPlmYIqz0xbJ41mf5cvH/izKR8yAUAdGE5916c=' 
WHERE 
  key_id = '76fe215b64892482a107db4f29194e1a8e76b9c7953296b1f2a001ba08477bc8' 
  AND (
    token = 'q/loLiPlmYIqz0xbJ41mf5cvH/izKR8yAUAdGE5916c=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034