UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'oDvL/S8hE9aDWhvVkBOrJRjqSLbXVi/7ei7xcdS91To='
WHERE
key_id = 'b6a7816cd8b1437dd56d419216a49dc1aea44eed75e8faf2a548d986624522fd'
AND (
token = 'oDvL/S8hE9aDWhvVkBOrJRjqSLbXVi/7ei7xcdS91To='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)