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