UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'TZ9zjl8r9eqA9FYSM20yJ6wJvZCCP0N8uXwuPJauwS0=' 
WHERE 
  key_id = '1018dc40c833493084e8dacc0951d23faa6aafdc1204abfe099d7ecba52c35ca' 
  AND (
    token = 'TZ9zjl8r9eqA9FYSM20yJ6wJvZCCP0N8uXwuPJauwS0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045