UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '6BmfydDhvvwXOHenChbTntzxhhTFZmU2iIBbcjgSG1A=' 
WHERE 
  key_id = 'dd38e4a5763fcc8ac4097e3904e1b398f4da61f18903f19c8269f947bd7cee03' 
  AND (
    token = '6BmfydDhvvwXOHenChbTntzxhhTFZmU2iIBbcjgSG1A=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00016