UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'x5pv/8X0WNO8hUIFqjviDcJbisLhwsL2xJWDZIBcLps='
WHERE
key_id = 'af7ea7dda24cee877b8f8e88d7dd5f86713e9492c0f070518c56c5b477b5b796'
AND (
token = 'x5pv/8X0WNO8hUIFqjviDcJbisLhwsL2xJWDZIBcLps='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)