UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'grPfo8N2CoemwttfB9uwFIr5d/VgCMuVcYnwktS96PA=' 
WHERE 
  key_id = 'e9e0bb6ed4e54132866d130cab3e3193f176136df10a01e4068e0932fdac202c' 
  AND (
    token = 'grPfo8N2CoemwttfB9uwFIr5d/VgCMuVcYnwktS96PA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035