UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'B1XKVD6HQDE3rc5sbB8sCcyS/zT/qWifvhdXjH5tywg='
WHERE
key_id = 'ef8a0cf333f710bf28f0b3fb647d596358910b080058ef90653f7e7adce7f8d4'
AND (
token = 'B1XKVD6HQDE3rc5sbB8sCcyS/zT/qWifvhdXjH5tywg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)