UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'SRQY7eONUgIyTgks8QEvaxTp0YY4212uqQmww9Mk6Gg=' 
WHERE 
  key_id = 'e3818b5759629ff8da0569cbf58ab013170565ee089f8c37988b22ca29287245' 
  AND (
    token = 'SRQY7eONUgIyTgks8QEvaxTp0YY4212uqQmww9Mk6Gg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023