UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'pCs3BKMliLHQ6w8Mv2RpeoO7EoDmLWB+MWe5wPBCpkM=' 
WHERE 
  key_id = '48f835430f0ddfe6a603f3030d2c368a220b533c3e62dfaddd614b08a79511d5' 
  AND (
    token = 'pCs3BKMliLHQ6w8Mv2RpeoO7EoDmLWB+MWe5wPBCpkM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040