UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '7uUviX0AbdtRq4z1naKC66aUV7wawosfHn9xnCvVixI=' 
WHERE 
  key_id = '20f7c4175f1b6ad0584625312e6bed7750c2c169317b99d1e83b7fe08520cd30' 
  AND (
    token = '7uUviX0AbdtRq4z1naKC66aUV7wawosfHn9xnCvVixI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031