UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'laYa6+w7cXxKyagpR8LCiYNn29WPs+Id8wqPYH6wdIg=' 
WHERE 
  key_id = '1b45066074e643572aa8a74f6c2f87980e856f47fb60f64ae325888483e7567a' 
  AND (
    token = 'laYa6+w7cXxKyagpR8LCiYNn29WPs+Id8wqPYH6wdIg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029