UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'NAjwe8IgV4dB65pcCFeugqJKRVeMDzzr+skIbGnE+88=' 
WHERE 
  key_id = 'c028519bf6fb43f895b6a30aa46adf09670710966d5df7d177c1eba287209c94' 
  AND (
    token = 'NAjwe8IgV4dB65pcCFeugqJKRVeMDzzr+skIbGnE+88=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028