UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Bo6WIf8xhaJl9Wr0gdzSvXHaKYPAHF4XE4Dxlklb7B8='
WHERE
key_id = 'aa50a7d41d77075f905d469b8bf9849b54c2f0a34d2b341e1eadd8e978f69e74'
AND (
token = 'Bo6WIf8xhaJl9Wr0gdzSvXHaKYPAHF4XE4Dxlklb7B8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)