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