UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'p+RmtId8rb4LSm/eDhe40o/HhOZXz7N3EejFW1LBXUw='
WHERE
key_id = 'b868874d7cf466a3b99f419b2b18ab9ae974b116363e286d111cac6f52318e55'
AND (
token = 'p+RmtId8rb4LSm/eDhe40o/HhOZXz7N3EejFW1LBXUw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)