UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ZrUd1OHjVWBlqSH4UXUhWoxGnAYN+NPFl6Hbe8OtZU8='
WHERE
key_id = 'cc22f1d51bcb4cec244a92bb1298fe1436b737c1b49376f5998d81d39abe17be'
AND (
token = 'ZrUd1OHjVWBlqSH4UXUhWoxGnAYN+NPFl6Hbe8OtZU8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)