UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dwseT0M7Y8RHF1nCmzxOn0rv8MgP9TxAzVsjx+Gg8YU=' 
WHERE 
  key_id = '26613bc1a7533356ba740ef8cb7dc54de9dc6a08587259870c8efd7cbd7734f3' 
  AND (
    token = 'dwseT0M7Y8RHF1nCmzxOn0rv8MgP9TxAzVsjx+Gg8YU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040