UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'vMesRRMAo4IhkgNxxSulL/F/E6+/UVKCKibVvaqD+Tw=' 
WHERE 
  key_id = '0aa9b062bd3117fbfd640c2e8601472966c04a8375282859ad7e70b59c7c56b0' 
  AND (
    token = 'vMesRRMAo4IhkgNxxSulL/F/E6+/UVKCKibVvaqD+Tw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030