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