UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '39LWfqlXWAPW6zYvopnM6jzFCKb5UD43+PSI98QvADM=' 
WHERE 
  key_id = '0d523e6350b62507f78682bf7e25495a14a47b55282feb0dfd8b7fc9b80d6f96' 
  AND (
    token = '39LWfqlXWAPW6zYvopnM6jzFCKb5UD43+PSI98QvADM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028