UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '8WXM6wkSbn7nGt9Cay836VMJYnt9ewtjbs1ZBb062A0='
WHERE
key_id = '9dff8eebf6e44a8e61c0713cd14ee6cd81c23dd840cfff86bfe2778e44f42493'
AND (
token = '8WXM6wkSbn7nGt9Cay836VMJYnt9ewtjbs1ZBb062A0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)