UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '49GxuhiKcl5mxeI4KkZ3uU4Ig9EJAjQ5xtbjK2nzOWA=' 
WHERE 
  key_id = '1a86370a65f22f089f60b4832524b724fccff6529381b021887550f57307c731' 
  AND (
    token = '49GxuhiKcl5mxeI4KkZ3uU4Ig9EJAjQ5xtbjK2nzOWA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031