UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'cWRIAIzy5YRXtx5ChJoDByv6kBy4lT9oqQArPFX+ugU=' 
WHERE 
  key_id = '9cde2118dd438e5e94ad37cb17588136ba010d4bf51194532f566556ffdac2fa' 
  AND (
    token = 'cWRIAIzy5YRXtx5ChJoDByv6kBy4lT9oqQArPFX+ugU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048