UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'an4S3t72bEXWFrxaOaIevQv9x8NuPUq1US6OcNfLPss=' 
WHERE 
  key_id = 'f0d296bb18276ce1ccedbec3dfe4aeacd6e1804becd6c89b4dab59aa5d4e8a98' 
  AND (
    token = 'an4S3t72bEXWFrxaOaIevQv9x8NuPUq1US6OcNfLPss=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039