UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'q1Vigv/lmuiGZ2uUdkH3TXa2SOXGqGv9Ci+gwxkAA5o=' 
WHERE 
  key_id = 'caf9e2090e31f529d62cd060d51aa69fd09f494bdc13fd35bd7f71b96af08a3c' 
  AND (
    token = 'q1Vigv/lmuiGZ2uUdkH3TXa2SOXGqGv9Ci+gwxkAA5o=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00052