UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'quxhcxq8Ps7J4HDopVZwFlyub2V7nEYmOwcCC0U4Qy8='
WHERE
key_id = '5fefd03e1c6d3cf7d26c2bb8ad126a7c89900909ff91be0d94ca233dd9e7a8ac'
AND (
token = 'quxhcxq8Ps7J4HDopVZwFlyub2V7nEYmOwcCC0U4Qy8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)