UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'b8IkW8UdjDxy8Gec2sAuiwPwJ5F6SaXPhjU1IDWWedU=' 
WHERE 
  key_id = '775987d986411436d7295edf4424e0ec75c179dc2cd82eb0d5847d9ffbb9b29f' 
  AND (
    token = 'b8IkW8UdjDxy8Gec2sAuiwPwJ5F6SaXPhjU1IDWWedU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050