UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'xuCxWhOVEbk2+WGOPu+L+znbUywFE+xr95+9SPVTGN8=' 
WHERE 
  key_id = 'd712fa60b9d67063bb05396c6910e9097a02d38df62a037e8235df7dbe154045' 
  AND (
    token = 'xuCxWhOVEbk2+WGOPu+L+znbUywFE+xr95+9SPVTGN8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017