UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'hUbfA+v5EtRT9ZaQHTfQWtYchRpK12fi6CySViWod2Y=' 
WHERE 
  key_id = '9c37f36da758fac8a924c02963c69c8233ba14b74ad164153e8363821792e3b4' 
  AND (
    token = 'hUbfA+v5EtRT9ZaQHTfQWtYchRpK12fi6CySViWod2Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046