UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'E6A1MxJRRNQzvpaaBPlzvQAIvwoPKVnrMluMtEvR7+E=' 
WHERE 
  key_id = '5cf1edec21fd3abe0162deadf0b825ad18ad82c699d5977054c6384dbf8f4645' 
  AND (
    token = 'E6A1MxJRRNQzvpaaBPlzvQAIvwoPKVnrMluMtEvR7+E=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00052