UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'IOYbTM60Dh7a/kI2OIV+NncQw9mdW785laH6mQ38ljk=' 
WHERE 
  key_id = '1a4a41a2eb4b599093a6e5ea76e0df7fc847736004f0715d9857458ace51fe48' 
  AND (
    token = 'IOYbTM60Dh7a/kI2OIV+NncQw9mdW785laH6mQ38ljk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024