UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'gImwTiNbnkBtB4/DlFVzU8KsvJbZ6X2RyRl0AbwzN10='
WHERE
key_id = '1aa5d39dc7091c73ac15cc1887e941df5d69b9323577dd189073fdd3567ca4d5'
AND (
token = 'gImwTiNbnkBtB4/DlFVzU8KsvJbZ6X2RyRl0AbwzN10='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)