UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '50eYBgHQxiLfbNd5BZ1wQAF27lz4H6Tt06I2M3/3uGw='
WHERE
key_id = '23ad54fa0fbbb8e9d7a4b7190874c868980a60996549a7c14f68f12ab86faff9'
AND (
token = '50eYBgHQxiLfbNd5BZ1wQAF27lz4H6Tt06I2M3/3uGw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)