UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'NFiQRXuz2X59xdVFD4XX8qhJrqCiwXjPuiMTsY5tfao=' 
WHERE 
  key_id = '1623d68d7d8cab6e73d55d63a0e0f1b7b30830068d021e5aacb9ca8a90b11dd1' 
  AND (
    token = 'NFiQRXuz2X59xdVFD4XX8qhJrqCiwXjPuiMTsY5tfao=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039