UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'TijegfknfZwgyZ4LzsqRG85JUYAAz0M/Cdbsha3I+Lw=' 
WHERE 
  key_id = '7f5b30ac1ad63cd2b60037456f5b3dab1490aedffd1e79cbcdb94f795e98c20f' 
  AND (
    token = 'TijegfknfZwgyZ4LzsqRG85JUYAAz0M/Cdbsha3I+Lw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044