UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'a1kbppH0kw2YWK9NeeX6viA398CCFZf42tYY58ipNR0=' 
WHERE 
  key_id = '590148399aa55565ee24edc485c9c50df4c752f7d5f9260cc115b93b7b1160a0' 
  AND (
    token = 'a1kbppH0kw2YWK9NeeX6viA398CCFZf42tYY58ipNR0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042