UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'cHxsavDWEVMYlrhCiazYO7bHvbL479/JXuAn0cyCEkw='
WHERE
key_id = 'd99c3fcc32ba827befc5206f98d42f11262188f03b05e119fcd9dfb1b39c89ad'
AND (
token = 'cHxsavDWEVMYlrhCiazYO7bHvbL479/JXuAn0cyCEkw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)