UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'L43yJp1/kDDzi489c1CTnK2wAViSJBgMVYqb9Ud49Ls='
WHERE
key_id = 'f849644b2cd587fab631d95ab5545cf9efc4b1d4aafbff136398ff1271a84887'
AND (
token = 'L43yJp1/kDDzi489c1CTnK2wAViSJBgMVYqb9Ud49Ls='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)