UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'q2JpRDYqObA7ZjWneH+7DWP1oOedvnI0uLoZZtER75Q=' 
WHERE 
  key_id = 'fdaf90c7c0e6941f60f885f27d4a44a3f186b8607fd1e274b454f2bc23a7ba4b' 
  AND (
    token = 'q2JpRDYqObA7ZjWneH+7DWP1oOedvnI0uLoZZtER75Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022