UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'OmvcNRgWmdOXZqYX2VpTRUXt6D5xdlg0SKreYSUxBrM=' 
WHERE 
  key_id = '7017ca4246299db801300f3cc72430d3fab6aa78ca28807d66a920caaf25d4af' 
  AND (
    token = 'OmvcNRgWmdOXZqYX2VpTRUXt6D5xdlg0SKreYSUxBrM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034