UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'bVM5AiAi4rq4G7kFr7U60LVIab9znb5ud7m2lnPZmYE='
WHERE
key_id = '9f77ec62c5ddec00c250c306ac46e325f12c9ade919be795637b1db4023231ec'
AND (
token = 'bVM5AiAi4rq4G7kFr7U60LVIab9znb5ud7m2lnPZmYE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)