UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'NqgJ09AyprURmYkcSRf4rmndScTw47e/N3VqcNqQNik='
WHERE
key_id = '7a676a0bb6832d972f0e77e95bd393513b9b585fd2c3c4c2c95d8c4fd5c3a8fd'
AND (
token = 'NqgJ09AyprURmYkcSRf4rmndScTw47e/N3VqcNqQNik='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)