UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KFMI4akqdEe+04UsYi9b5I+IpUjuB2cSePVSBoU/eHE=' 
WHERE 
  key_id = 'd6fc4fce248952d4070c8c8020dd801a0e1fb66484260ebed919561a2eb9349b' 
  AND (
    token = 'KFMI4akqdEe+04UsYi9b5I+IpUjuB2cSePVSBoU/eHE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035