UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'cfQv8MG971GYKyA7riTLXi2Q/Ff2z5B9X17uT/t3PHA=' 
WHERE 
  key_id = '7ef86e9a7781c2d32826c7a0639ce24210c4b32bc546a8aaf5a28decfe5a15e5' 
  AND (
    token = 'cfQv8MG971GYKyA7riTLXi2Q/Ff2z5B9X17uT/t3PHA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00016