UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'MtkLlJoTmsmZ51vrBAcbZxWALbNoGrTBGcwb1Pl2m6I='
WHERE
key_id = '4181e755784fa111d8c4579d5d6e5c1c82e8389e7f6b581727301e24316a9ae5'
AND (
token = 'MtkLlJoTmsmZ51vrBAcbZxWALbNoGrTBGcwb1Pl2m6I='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)