UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ijTaLvBYnlclENAs6nh99rI5pkgNFW7jzEjnu5pBVxE=' 
WHERE 
  key_id = '744a2eb9c9aa3bcde0f335a732444fff86335cd530a35d940709698dc84ad653' 
  AND (
    token = 'ijTaLvBYnlclENAs6nh99rI5pkgNFW7jzEjnu5pBVxE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044