UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'mDrC2eXS21y6svdIWDXLvl7DRvCGi0bWhZQTaSP72po='
WHERE
key_id = 'bf9afb169c9f3dc81daa3dbb94339ddf277f3572d3003d8cd815a2043baeeb4f'
AND (
token = 'mDrC2eXS21y6svdIWDXLvl7DRvCGi0bWhZQTaSP72po='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)