UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'S3PUw1g3MZK2VRuIIRflG1Yi3G+G6nqRgPmn9GVFjRc=' 
WHERE 
  key_id = 'c81bbad8ce55a89d7a05ac5d43347c9bdf8464b00c470884dab3ac1ffa605a05' 
  AND (
    token = 'S3PUw1g3MZK2VRuIIRflG1Yi3G+G6nqRgPmn9GVFjRc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040