UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'b7mkTWMNQnmKJH31p4SBNnfomXInLd8A325cLSIGTcU=' 
WHERE 
  key_id = '2e34ced4795dc4566f9ad0f6e1e3481189d17d3ad06b74d1b3607a267b355523' 
  AND (
    token = 'b7mkTWMNQnmKJH31p4SBNnfomXInLd8A325cLSIGTcU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031