UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'cVw8fnKAzTipTks5EftfgEc8tQHmbjSFL99/c2SuP3c=' 
WHERE 
  key_id = 'bc2cf234628ad58dcd136f7b2694f7b469cfe5de19e96cf28d138dfcca40a087' 
  AND (
    token = 'cVw8fnKAzTipTks5EftfgEc8tQHmbjSFL99/c2SuP3c=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031