UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'jgHzNMKqqneLeW9+xHmKHEl+pPGqiSWY8Ie7jJ7fSdU=' 
WHERE 
  key_id = '7f2bca581d74bedc4485b87ff26bd4958da1607e71365ebed5d1780a914f1343' 
  AND (
    token = 'jgHzNMKqqneLeW9+xHmKHEl+pPGqiSWY8Ie7jJ7fSdU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035