UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'wtOH5rE7HAZSwLrIbsyLamlfbnnYtN++qom6QSIZXN0='
WHERE
key_id = '1597483bbdf0087537b2aba3dfeffb3ec63a71efdb2a5f229792828294cab2cf'
AND (
token = 'wtOH5rE7HAZSwLrIbsyLamlfbnnYtN++qom6QSIZXN0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)