UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'kHlaYIEC4Vp/wk9x31KfCn+LALiP8gLo47wN9EB+YII='
WHERE
key_id = '0c1882487ae576fd51e82708f5e75b5a593ff0a19099c852d0043aea59771376'
AND (
token = 'kHlaYIEC4Vp/wk9x31KfCn+LALiP8gLo47wN9EB+YII='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)