UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Y+FiANwjQqsXa73uIvqrMK2n13dhlgJV6jp+x+t8HKI='
WHERE
key_id = 'b8e5fd4107e6ef45be748387664d1ace492236822a298f80e690b44176102395'
AND (
token = 'Y+FiANwjQqsXa73uIvqrMK2n13dhlgJV6jp+x+t8HKI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)