UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'QWciB9u5zIuQToO+mDWVqC2pqGHDg0iiTjiFR4lxAhE='
WHERE
key_id = 'c59a20a67d1bc77e14225659db0aef3724ed03acdf13ca553bd1470e4b419c84'
AND (
token = 'QWciB9u5zIuQToO+mDWVqC2pqGHDg0iiTjiFR4lxAhE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)