UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'j0us2bgsPrJanbH6l0wV63NZh6O6RK9CsqMtStgwcgc=' 
WHERE 
  key_id = '5199dc67e8d52bed75fea500950a7632f838621b123f0a6bc79d3e1b77a87c39' 
  AND (
    token = 'j0us2bgsPrJanbH6l0wV63NZh6O6RK9CsqMtStgwcgc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037