UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'E5Db86hI7Y3sF49x8PERxNlDwRI0yuYSrKyoXBg3TrE=' 
WHERE 
  key_id = '585f2ad4efe29bf161d69337ab0d771789cccd058f09f26be0062225ecf8b1a7' 
  AND (
    token = 'E5Db86hI7Y3sF49x8PERxNlDwRI0yuYSrKyoXBg3TrE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00018