UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'IlkTFzDWidxW+yxb0jcxeF3x6nGiKuXOJ1vlO18ofqM=' 
WHERE 
  key_id = '9a0a4e773dc0562ada30b98e47ccc6bef9d3f9b84563914f53ca108fb1c7099b' 
  AND (
    token = 'IlkTFzDWidxW+yxb0jcxeF3x6nGiKuXOJ1vlO18ofqM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024