UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'JswpSXZGBL8Jtu7dy6Yny2I7y9WvTwRnKMmoc0CdN1o=' 
WHERE 
  key_id = '517905ef9f6d38480fdbb9dd11e9b1ad67a968f4427233240f1360bc709d0bc4' 
  AND (
    token = 'JswpSXZGBL8Jtu7dy6Yny2I7y9WvTwRnKMmoc0CdN1o=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028