UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'EotwW2DnkJPSp44CzWzaxd2jpU+h+jNM6L2RudgWxBA=' 
WHERE 
  key_id = '146cb023538296f3bd186d293b6ac1916444829d7993a1757533262f0c693270' 
  AND (
    token = 'EotwW2DnkJPSp44CzWzaxd2jpU+h+jNM6L2RudgWxBA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048